package com.xx.pmis.web.servlets;

/**
 * @class <br>
 * 
 * @editor 石星星  @Date 2011-9-23 下午05:28:18 <br>
 * @version jdk_1.5.0
 */
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.PropertyConfigurator;

public class InitLog4j extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4760317899218718291L;

	public void destroy() {
		super.destroy();
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}

	public void init() throws ServletException {
		String basePath = getServletContext().getRealPath("/");
		String confFile = getInitParameter("log4j");
		if (confFile != null) {
			PropertyConfigurator.configure(basePath + confFile);
		} else {
			System.out.println("指定的Log4j配置文件不存在，将影响应用中的日志记录输出！");
		}
	}
}
